<template>
	<view class="box">
		<u-navbar title="元宝换通宝" :fixed="true" :placeholder="true" :safeAreaInsetTop="true" :autoBack="false"
			leftIconColor="#666" titleStyle="color:#333" bgColor=" #E0DDDA" rightText="购买订单" @rightClick="right"
			@leftClick="leftClick"></u-navbar>
		<view class="wrap">
			<view class="navwrap">
				<view class="nav" @click="sel=1"  :class="{active:sel==1}" >
					<view class="navtop">
						可用额度 <text style="font-size: 32rpx;font-weight: 600;margin-left: 10rpx;">充足</text>
					</view>
					<view class="navbottom">
						1通宝兑换1元宝
					</view>
					<image v-if="sel==1" src="../../static/image/xz.png" mode=""></image>
				</view>
				<view class="nav" @click="goDAOjs"   :class="{active:sel==2}">
					<view class="navtop">
						DAO寄售
					</view>
					<view class="navbottom">
						0.7元宝换1通宝起
					</view>
					<image v-if="sel==2" src="../../static/image/xz.png" mode=""></image>
				</view>
			</view>

			<view class="tit">
				输入兑换数量
			</view>
			<view class="iptwrap">
				<input type="digit" v-model.trim="num" placeholder="请输入数量" />
				<view class="money">
					<image src="../../static/image/fhtb.png" mode=""></image>
					<text>福合通宝</text>
				</view>
			</view>
			<view class="ss">
				服务费率1.5%
			</view>
			<view class="tabs">
				<view class="tabsitem">
					<view class="tabsitemtop">
					<image src="../../static/image/fhtb.png" mode=""></image>
					<text>福合通宝</text>
					</view>
					<view class="tabitems">
						兑换前：12005.00
					</view>
					<view class="tabitems">
						兑换后：12005.00
					</view>
				</view>
				<view class="tabsitem" style="margin-left: 80rpx;">
					<view class="tabsitemtop">
					<image src="../../static/image/fhyb.png" style="width: 42rpx;height: 30rpx;" mode=""></image>
					<text>福合元宝</text>
					</view>
					<view class="tabitems">
						兑换前：12005.00
					</view>
					<view class="tabitems">
						兑换后：12005.00
					</view>
				</view>
			</view>
		</view>
		<view class="btn">
			兑换
		</view>
	<!-- 	<view class="btn" style="opacity: 0.5;">
			暂无额度，请稍后重试，或寄售兑换订单
		</view>
		<view class="btn" @click="gojstbvsyb">
			寄售兑换订单
		</view> -->
		<view class="tip">
			<rich-text  class="s" :nodes="rule"></rich-text>
		</view>
		<u-popup :show="showpass" mode="center" @close="showpass=false" closeable bgColor="transparent">
			<view class="pass_wrap">
				<view class="tit">
					请输入交易密码
				</view>
				<u-code-input disabledDot :adjustPosition="false" borderColor="#A68A64" focus class="code_input"
					v-model="password" mode="line" dot></u-code-input>
				<view class="other_btnwrap">
					<view class="other_btn1" @click="showpass=false,password=''">
						取消
					</view>
					<view class="other_btn2" @click="submittopup">
						确认
					</view>
				</view>
			</view>
		</u-popup>
	
		<!-- <u-picker :show="show" :columns="amount" @cancel="show=false" @confirm="confirm"></u-picker> -->
	</view>

</template>

<script>
	import {WithdrawInfo,fhTransfer} from "../../api/wallet.js"
	export default {
		data() {
			return {
				num:"",
				showpass:false,
				rule:"adasdasd",
				password:"",
				sel:1
			}
		},
		onLoad() {

			

		},
		computed:{
			 isAlphaNumeric() {
			  const pattern = /^[A-Za-z0-9]+$/;
			  return pattern.test(this.account);
			},
			daozhangprice() {
				const price = Number(this.num)
				const fl = Number(this.fee) / 100
				return (this.roundDown(price - price * fl, 2)).toFixed(2)
			}
		},
		methods: {
			right(){
				uni.navigateTo({
					url:"/pagesMy/mywallet/dhlist"
				})
			},
			leftClick() {
				//获取页面栈的长度
				const canNavBack = getCurrentPages()
				console.log(canNavBack.length);
				// 判断是否刷新了浏览器，刷新了浏览器，页面栈只有当前一个
				if (canNavBack.length > 1) {
					uni.navigateBack({
						delta: 1
					})
				} else {
					uni.navigateTo({
						url: '/pagesMy/mywallet/newmywallet'
					})
				}
			},
			gojstbvsyb(){
				uni.navigateTo({
					url:"/pagesMy/mywallet/jstbvsyb"
				})
			},
			goDAOjs(){
				uni.navigateTo({
					url:"/pagesMy/mywallet/daojs"
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	@font-face {
		font-family: 'iconfont';
		src: url("~@/iconfont/almm.ttf");
	}
	.active {
		
				background: #EDE8E0 !important;
		border: 2rpx solid #A68A64;
	}
	.box {
		width: 750rpx;
		height: 100vh;
		background-color: #E0DDDA;
	}
	.navwrap{
		display: flex;
		flex-wrap: wrap;
		.nav{
			width: 300rpx;
			height: 128rpx;
			background: #F3F5F7;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			// padding-top: 50rpx;
			margin-left: 30rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			border: 2rpx solid #A68A64;
			// padding-top: 20rpx;
			.navtop{
				font-weight: 400;
				font-size: 30rpx;
				color: #333333;
			}
			.navbottom{
				margin-top: 10rpx;
				font-weight: 400;
				font-size: 26rpx;
				color: #A68A64;
			}
			>image{
				width: 300rpx;
				height: 128rpx;
				position: absolute;
			}
		}
	}
	.wrap{
		width: 690rpx;
		height: 700rpx;
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin: 0 auto;
		margin-top: 30rpx;
		padding-top: 50rpx;

	}
	.tip {
		width: 702rpx;
		margin: 0 auto;
		margin-top: 84rpx;
		>text {
			font-weight: 400;
			font-size: 24rpx;
			color: #A6A5AF;
		}
	}
	.btn{
		width: 690rpx;
		height: 88rpx;
		background: linear-gradient( 90deg, #AB8E68 0%, #D7BA93 100%);
		border-radius: 332rpx 332rpx 332rpx 332rpx;
		margin: 0 auto;
		font-weight: 400;
		font-size: 36rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 88rpx;
		margin-top: 50rpx;
	}
	.tabs{
		width: 604rpx;
		margin: 0 auto;
		display: flex;
		align-items: center;
		margin-top: 50rpx;
		justify-content: space-between;
		.tabsitem{
			width: 50%;
			// height: 80rpx;
			.tabsitemtop{
				display: flex;
				align-items: center;
				>image{
					width: 32rpx;
					height: 32rpx;
				}
				>text{
					font-weight: 400;
					font-size: 32rpx;
					color: #333333;
					margin-left: 10rpx;
				}
			}
			.tabitems{
				font-weight: 400;
				font-size: 28rpx;
				color: #666666;
				margin-top: 20rpx;
			}
		}
	}
	.iptwrap{
		width: 624rpx;
		height: 86rpx;
		background: #F2EFEC;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		margin: 0 auto;
		display: flex;
		align-items: center;
		padding-left: 20rpx;
		margin-top: 28rpx;
		>input{
			width: 350rpx;
		}
		.money{
			display: flex;
			align-items: center;
			>image{
				width: 32rpx;
				height: 32rpx;
			}
			>text{
				margin-left: 10rpx;
				font-weight: 400;
				font-size: 28rpx;
				color: #A68A64;
			}
		}
	}
	.ss{
		font-weight: 400;
		font-size: 26rpx;
		color: #999999;
		margin-top: 20rpx;
		margin-left: 32rpx;
	}
	.tit{
		font-weight: 400;
		font-size: 30rpx;
		color: #333333;
		margin-left: 32rpx;
		margin-top: 50rpx;
	}
	.prompt {
		width: 600rpx;
		min-height: 400rpx;
		background: #E0DDDA;
		margin: 0 auto;
		border-radius: 20rpx;
		color: #333;
		padding-top: 30rpx;
	}

	.prompt>text {
		margin-top: 40rpx;
	}

	.prompt_tit {
		margin: 0 30rpx;
		font-size: 28rpx;
		color: #333;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}

	.prompt_ntm {
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 30rpx;
		width: 414rpx;
		height: 72rpx;
		line-height: 72rpx;
		background: linear-gradient( 90deg, #AB8E68 0%, #D7BA93 100%);
		border-radius: 28rpx;
		margin-top: 80rpx;
		color: #ffffff;
	}
	.pass_wrap {
		width: 602rpx;
		height: 406rpx;
		background: #E0DDDA;
		border-radius: 22rpx 22rpx 22rpx 22rpx;
		z-index: 998;

		.tit {
			width: 602rpx;
			text-align: center;
			font-size: 36rpx;
			color: #333;
			padding-top: 50rpx;
			margin-bottom: 70rpx;
		}

		.code_input {
			margin: 0 auto;
		}

		.other_btnwrap {
			width: 522rpx;
			height: 72rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin: 0 auto;
			margin-top: 50rpx;

			.other_btn1 {
				width: 220rpx;
				height: 72rpx;
				border-radius: 280rpx 280rpx 280rpx 280rpx;
				border: 2rpx solid #A68A64;
				font-size: 28rpx;
				color: #A68A64;
				text-align: center;
				line-height: 72rpx;
			}

			.other_btn2 {
				width: 220rpx;
				height: 72rpx;
				background: linear-gradient(90deg, #AB8E68 0%, #D7BA93 100%);
				border-radius: 280rpx 280rpx 280rpx 280rpx;
				font-size: 28rpx;
				color: #FFFFFF;
				text-align: center;
				line-height: 72rpx;
			}
		}

		.u-code-input {
			display: flex;
			align-items: center;
			justify-content: center;
		}

		/deep/.u-code-input__item {
			width: 30px !important;
			height: 30px !important;
			margin-right: 14px !important;
		}

		/deep/.u-code-input__item>text {
			color: #fff !important;
		}
		
	}
	.binding {
		width: 90%;
		margin: 0 auto;
		padding: 18rpx 0;
		// border-radius: 60rpx;
		// background: #2B2749;
		border-bottom: 1rpx solid #5a5a5a70;

		>text {
			font-weight: 400;
			font-size: 32rpx;
			color: #333;
			margin-right: 68rpx;
		}
		/deep/.uni-input-wrapper {
			color: #A6A5AF !important;
		}
		/deep/.uni-input-input {
			color: #333;
			font-weight: 300;
			font-size: 36rpx;
		}
		
	}

	/deep/.u-button--success {
		background: none !important;
		border: none !important;
		color: #A68A64!important;
	}



	/deep/.u-border {
		border: none;
		// border-bottom: 2rpx solid rgba(255, 44, 223, 0.5) !important;
	}



	/deep/.uni-input-placeholder {
		color: #A6A5AF !important;
	}
	
</style>